(setq load-path (cons "~/.emacs.d/libs" load-path))

(add-hook 'text-mode-hook 'turn-on-auto-fill)

(load "desktop") 
(desktop-save-mode 1)
(require 'tabbar)
(tabbar-mode)

;; ede
(require 'ede)
(global-ede-mode t)

;; column number
(column-number-mode t)

;; theme
(require 'color-theme-textmate2)
(color-theme-textmate2)

;; key bindings

;; fonts
;;(set-default-font "DejaVu Sans Mono-10")
(set-default-font "Monaco-10")
(set-fontset-font (frame-parameter nil 'font)
          'unicode
          '("DejaVu Sans Mono-10" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
                  'han '("Microsoft YaHei" . "unicode-bmp"))
;;;(set-fontset-font (frame-parameter nil 'font)
;;;              'han
;;;          '("SimSun" . "unicode-bmp"))

;; Removing Annoyances
(setq mouse-yank-at-point t)
(setq kill-ring-max 200)
(setq scroll-margin 3
            scroll-conservatively 10000)
;;(setq frame-title-format "emacs@%b")
(setq frame-title-format "%S: %f")
;;(setq frame-title-format
;;        '("%S: " (buffer-file-name "%f" (dired-directory dired-directory "%b"))))
;; inhibit startup messages.
(setq inhibit-startup-message t)
;; make the last line end in a carriage return.
(setq require-final-newline t)
;; allow you to type just "y" instead of "yes" when you exit.
(fset 'yes-or-no-p 'y-or-n-p)
;; disallow creation of new lines when you press the "arrow-down key" at end of the buffer.
(setq next-line-add-newlines nil)

;; General Embellishments
;; highlight matching parentheses next to cursor.
(require 'paren) (show-paren-mode t)

;; C-mode with Fewer Key-strokes
;; make "Ctrl-k" kills an entire line if the cursor is at the beginning of line
(setq kill-whole-line t)
;; delete "hungrily" in C mode! 
(setq c-hungry-delete-key t)
;; let emacs put in a "carriage-return" for you automatically after left curly braces, right curly braces, and semi-colons in "C mode"
(setq c-auto-newline 1)

(add-hook 'snippet-cleanup-hook 'llasram/mmm-parse-buffer-maybe)
(defun llasram/mmm-parse-buffer-maybe ()
    (when mmm-mode
          (mmm-parse-buffer)))

(require 'align)
(setq make-backup-files nil)

(setq default-fill-column 80)

(setq x-select-enable-clipboard t) ; as above
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
